package com.srp.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserTreeMapper {
    @Insert("insert into user_tree(user_id,tree_id)" +
            " value (#{user_id},#{tree_id})")
    int insert(String user_id,String tree_id);
    @Delete("delete from user_tree where user_id = #{user_id} and  tree_id = #{tree_id}")
    void delById(String user_id,String tree_id) ;
    @Select("select tree_id from user_tree where user_id = #{user_id} and  tree_id = #{tree_id}")
    String selectByIdAndTreeId(String user_id,String tree_id);
    @Select("select tree_id from user_tree where user_id = #{user_id}")
    List<String> selectById(String user_id);
    @Select("select count(*) from user_tree where user_id = #{user_id} and  tree_id = #{tree_id}")
    int getCountByIdAndTreeId(String user_id,String tree_id);
}
